//
//  Define.h
//  MainDemo
//
//  Created by FM on 2017/1/9.
//  Copyright © 2017年 FM. All rights reserved.
//

#ifndef Define_h
#define Define_h

#define USER_DEFAULT(str)               [[NSUserDefaults standardUserDefaults] objectForKey:str]
#define    OPEN_URL(URL)                   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL]]

//屏幕适配系数-x
#define kPercenX_scale(value) (value *[UIScreen mainScreen].bounds.size.width/375)

//设备屏幕高度
#define WIDTH   [UIScreen mainScreen].bounds.size.width
#define HEIGHT   [UIScreen mainScreen].bounds.size.height


#define UIColorFromRGB(rgbValue)        [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

//Function Color
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define UIColorFromRGB(rgbValue)        [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define Color_333333 UIColorFromRGB(0X333333)
//黄颜色
#define Color_fac444 UIColorFromRGB(0Xfac444)

//边框灰
#define Color_e5e5e5 UIColorFromRGB(0Xe5e5e5)

#ifdef DEBUG
# define WWLog(format, ...) NSLog((@"[:%s]""[行号:%d]" format), __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define WWLog(...);
#endif
#define IOS11 @available(iOS 11.0, *)
#define isIPhoneX (CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size))
//屏幕适配系数-x
#define kPercenX_scale(value) (value *[UIScreen mainScreen].bounds.size.width/375)
#define Image_name(format,...)  [UIImage imageNamed:format]
#define iphone_rect_scale(x,y,w,h) CGRectMake(kPercenX_scale(x), kPercenX_scale(y), kPercenX_scale(w), kPercenX_scale(h))
//状态栏高
#define StatusHeight   (isIPhoneX ? 44.f : 20.f)
// Navigation bar height.
#define  NavHeight  44.f

// Tabbar height.
#define TabbarHeight  (isIPhoneX ? (49.f+34.f) : 49.f)
#define BottomHeight  (isIPhoneX ? (34.f) : 0.0f)
// Status bar & navigation bar height.
#define  StatusBarAndNavBarHeight  (isIPhoneX ? 88.f : 64.f)
#define iphone_size_scale(w,h) CGSizeMake(kPercenX_scale(w), kPercenX_scale(h))

#define Font(index) [UIFont systemFontOfSize:kPercenX_scale(index)]
#define Font_Bold(index)     [UIFont boldSystemFontOfSize:kPercenX_scale(index)]
#define Font_Regular(index)  [UIFont systemFontOfSize:kPercenX_scale(index)]//PingFangSC-Regular
#define Font_Semibold(index) [UIFont boldSystemFontOfSize:kPercenX_scale(index)]//PingFangSC-Semibold  .PingFang-SC-Medium

#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define UIColorFromRGB(rgbValue)        [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBAndAlphaCOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#endif /* Define_h */
